package com.slz3.business.module.socialManagement.socShow.domain;

import com.slz3.business.frame.enums.AuditFlag;
import com.slz3.business.frame.enums.UsingFlag;
import com.slz3.business.frame.util.UUIDUtils;
import com.slz3.business.frame.util.VE;

import java.time.LocalDateTime;

public class SocShowFactory {

    /**
     * 初始化基础属性值
     */
    public static SocShow initBaseFields(SocShow socShow) {
        if (socShow.getUuid() == null) {
            socShow.setUuid(UUIDUtils.generateUUID());
            socShow.setCreateTime(LocalDateTime.now());
            if (VE.isEmpty(socShow.getSerAudit())) {
                socShow.setSerAudit(AuditFlag.WAIT_SUBMIT);
            }
            if (VE.isEmpty(socShow.getSerUsing())) {
                socShow.setSerUsing(UsingFlag.ENABLE);
            }
        } else {
            socShow.setLastModifyTime(LocalDateTime.now());
        }
        return socShow;
    }

    /**
     * 初始化基础属性值
     */
    public static SocShow initBaseFields() {
        return initBaseFields(newTemStyle());
    }

    public static SocShow newTemStyle() {
        return new SocShow();
    }

}
